import java.util.Scanner;

public class TestRelease {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {//对try按下alt+回车
            int a = scanner.nextInt();
            int[] array = {1, 2, 3};
            System.out.println(array[2]);
            System.out.println("after");
        } catch (ArithmeticException arithmeticException) {
            arithmeticException.printStackTrace();
            System.out.println("捕捉到了ArithmeticException异常");
        } catch (NullPointerException nullPointerException) {
            nullPointerException.printStackTrace();
            System.out.println("捕捉到了NullPointerException异常");
        } finally {
            //close方法消失
            System.out.println("我是finally,用于资源的释放");
        }
    }
}
